// 1. 引入异步对象
import request from '@/utils/request'
import type { AttrInfoModel, AttrListModel } from './model/attr'
import type { CategoryIdsModel } from './model/categoryModel'
// 2. 使用枚举存储接口地址
enum Api {
    getAttrListApi = '/admin/product/attrInfoList',
    delAttrListApi = `/admin/product/deleteAttr`,
    AddAttrListApi = `/admin/product/saveAttrInfo`
}
// 根据3级联动框获取对应的表格中数据
export const reqGetAttrListDataByCategory3Id = ({ category1Id, category2Id, category3Id }: CategoryIdsModel) => {
    return request.get<any, AttrListModel>(`${Api.getAttrListApi}/${category1Id}/${category2Id}/${category3Id}`)
}
// 删除属性
export const reqDelAttrListData = (attrId: number) => {
    return request.delete<any, null>(`${Api.delAttrListApi}/${attrId}`)
}

// 添加基础属性
export const reqAddAttrInfoData = (attrInfo: AttrInfoModel) => {
    return request.post<any, null>(`${Api.AddAttrListApi}`, attrInfo)
}
